package common.statusenum;

import java.util.HashMap;

/**
 * 全局枚举
 *
 * @author yuanqinglong
 * @since 2020/9/8 9:50
 */
public enum CommonEnum {

    /**
     * .
     */
    YEAR(CommonEnum.YEAR_CODE, "year"),
    MONTH(CommonEnum.MONTH_CODE, "month"),
    DAY(CommonEnum.DAY_CODE, "day");

    public static final String YEAR_CODE = "1";
    public static final String MONTH_CODE = "2";
    public static final String DAY_CODE = "3";


    private final String code;
    private final String msg;

    CommonEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    public String getCode() {
        return this.code;
    }


    public String getMsg() {
        return this.msg;
    }

    static HashMap<String, String> map = new HashMap(32);

    static {
        for (CommonEnum value : CommonEnum.values()) {
            map.put(value.code, value.msg);
        }
    }

    public static String getMsgByCode(String code) {
        return map.get(code);
    }

}
